# -*- coding: utf-8 -*-
# @project: huawang-api20230914
# @file： tmp_lg_03.py
# @Time：2023/8/24 13:19
# @Author：liaogan


# -*- coding: utf-8 -*-
# @project: huawang-api20230914
# @file： tmp_lg-03.py
# @Time：2023/8/16 17:14
# @Author：liaogan
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from time import sleep
# from po.public_methods import yk_tt_ui_login

# driver=yk_tt_ui_login(mode=1)
# driver.implicitly_wait(10)
# driver.get('')
# driver.find_element(By.XPATH,"//div[@class='el-submenu__title']//span[contains(text(),'商品管理')]").click()
# driver.find_element(By.XPATH,"//li[@role='menuitem']//span[contains(text(),'管理商品')]").click()
# sleep(5)
# driver.find_element(By.XPATH,"//button[@class='el-button filter-item el-button--primary el-button--mini']").click()
# print(driver.get_window_rect())
# print(driver.get_window_size())
# driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
# sleep(10)
driver_com = webdriver.Chrome()
driver_com.implicitly_wait(10)
driver_com.get('http://testview.booseng.com/hwyd/#/login')
driver_com.maximize_window()
sleep(3)
driver_com.find_element(By.XPATH, '//*[@placeholder="账号"]').send_keys('admin')
driver_com.find_element(By.XPATH, '//*[@placeholder="密码"]').send_keys('123456')
driver_com.find_element(By.XPATH, '//*[@placeholder="验证码"]').send_keys('123456')
driver_com.find_element(By.CSS_SELECTOR, '[class="el-button el-button--primary el-button--medium"]').click()
sleep(1)
print(driver_com.current_url)

driver_com.find_element(By.XPATH,"//div[@class='el-submenu__title']//span[contains(text(),'商品管理')]").click()
driver_com.find_element(By.XPATH,"//li[@role='menuitem']//span[contains(text(),'管理商品')]").click()
driver_com.find_element(By.XPATH,"//button[@type='button']//span[contains(text(),'新增')]").click()
sleep(3)
driver_com.find_element(By.XPATH,"//input[@placeholder='请输入商品名称']").send_keys('test2023')

driver_com.find_element(By.XPATH,"(//input[@placeholder='请选择'])[2]").click()
sleep(1)
driver_com.find_element(By.XPATH,"//div[@x-placement='bottom-start']//li[2]").click()

driver_com.find_element(By.XPATH,'//input[@placeholder="请输入商品关键字"]').send_keys('酒')
driver_com.find_element(By.XPATH,"//input[@placeholder='请输入单位']").send_keys('瓶')

driver_com.find_element(By.XPATH,"//textarea[@placeholder='请输入商品简介']").send_keys('商品简介')
driver_com.find_element(By.XPATH,"(//input[@placeholder='请选择'])[3]").click()
driver_com.find_element(By.XPATH,"//li[contains(text(),'1030306-果酒/米酒')]").click()
sleep(1)

driver_com.find_element(By.XPATH,"//label[contains(text(),'商品封面图：')]/..//*[@class='el-icon-plus']").click()
sleep(1)
driver_com.find_element(By.XPATH,"//div[@aria-label='checkbox-group']//div[1]//div[1]//div[1]//div[2]//label[1]//span[1]//span[1]").click()
driver_com.find_element(By.XPATH,"(//span[contains(text(),'确 定')])[3]").click()
sleep(1)

driver_com.execute_script('window.scrollBy(0,300)')

driver_com.find_element(By.XPATH,"//label[contains(text(),'商品轮播图：')]/..//*[@class='el-icon-plus']").click()
sleep(2)
driver_com.find_element(By.XPATH,"//body/div[5]/div/div[2]/section/main/div/div[2]/div/div[1]/div/div[1]/div/div/div[2]/label/span[1]/span").click()
driver_com.find_element(By.XPATH,"(//span[contains(text(),'确 定')])[3]").click()
sleep(1)

# #滑动滑块到最下面
# driver_com.execute_script('window.scrollBy(0,300)')
# driver_com.find_element(By.XPATH,"//div[@class='cell']//div//i[@class='el-icon-plus']").click()
# sleep(2)
# driver_com.find_element(By.XPATH,"//div[@aria-label='checkbox-group']//div[1]//div[1]//div[1]//div[2]//label[1]//span[1]//span[1]").click()
# driver_com.find_element(By.XPATH,"(//span[contains(text(),'确 定')])[3]").click()
# input('qqwww')
sleep(60)



